<template>
  <div id="content">
    <div class="content-flex">
      <div class="content-left">
        <div class="img-flase" title="假装是个图片">{{list.images.small}}</div>
      </div>
      <div class="content-right">
        <p>
          名字:
          <span>{{list.original_title}}</span>
        </p>
        <p>
          类型:
          <span v-for="(item,index) in list.tags" :key="index">{{item}}、</span>
        </p>
        <p>
          主演:
          <span v-for="(item,index) in list.casts" :key="index">{{item.name}}、</span>
        </p>
        <p>
          导演:
          <span>{{list.directors[0].name}}</span>
        </p>
      </div>
    </div>
    <div class="comment">
      <i>影评:</i>
      <div class="summary">{{list.summary}}</div>
      <div class="flex">
        <router-link
          :to="`/actress:${item.id}`"
          tag="div"
          class="comment-content"
          v-for="(item,index) in list.casts"
          :key="index"
        >
          <div class="false-img">{{item.avatars.small}}</div>
          <div class="comment-font">{{item.name}}</div>
        </router-link>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      msg: "详情信息",
      list: [],
      count: 10,
      start: 0
    };
  },
  methods: {
    requestData() {
      var urlId = this.$route.params.id.replace(":", "");
      //   console.log(urlId);

      var url =
        "http://api.douban.com/v2/movie/subject/" +
        urlId +
        "?apikey=0df993c66c0c636e29ecbb5344252a4a&tdsourcetag=s_pcqq_aiomsg&qq-pf-to=pcqq.c2c";
      this.$http.jsonp(url).then(res => {
        this.list = res.body;

        this.$store.commit("savaSearch", res.body);
      });
    }
  },
  mounted() {
    var datas = this.$store.state.Search;
    if (datas.length > 0) {
      this.list = this.$store.state.Search;
      console.log(this.list);
    } else {
      this.requestData();
    }
  },
  watch: {
    $route: "requestData"
  }
};
</script>

<style>
</style>